package com.hjj.controller;

import com.hjj.beans.Question;
import com.hjj.dto.ResultDTO;
import com.hjj.services.QuestionServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping("/question")
public class QuestionController {
    @Autowired
    QuestionServices questionServices;

    @RequestMapping("getAll.action")
    public ResultDTO getAll(){
        ArrayList<Question> all = questionServices.getAll();

        // 封装数据传输对象
        ResultDTO resultDTO = new ResultDTO();
        resultDTO.setResult(ResultDTO.SUCCESS);
        resultDTO.setReason("查询成功");
        resultDTO.setData(all);

        return resultDTO;
    }

}
